package org.e_gold.util;

import org.apache.commons.lang.StringUtils;

public class Enums{

	public static enum BetConfigEnum{
		BET_TIMES,
		BET_AMOUNT_PER_TIME,
		BET_CURRENT_COUNT,
		BEST_STRING_SIMILARITY,
		BET_RATE_MIN,
		BET_RATE_MAX,
		SAFE_MODE,
		CURRENT_GOAL,
		TOTAL_GOAL,
		BET_SETTING,
		BASE_AMOUNT,
		WON_PERCENT,
		BET_365_CRAWLER, 
		LAST_BET_AMOUNT;
	}

	public static enum ContractTypeEnum{
		FULL_TIME("Fulltime Result", 0),
		ALTERNATE_MATCH_GOAL("Alternative Match Goals", 1);

		private String type;
		private int code;

		ContractTypeEnum(String type, int code){
			this.type = type;
			this.code = code;
		}

		public String getDisplay(ContractTypeEnum ct){
			return ct.type;
		}

		public int getCode(ContractTypeEnum ct){
			return ct.code;
		}

		public static ContractTypeEnum fromCode(int code){
			ContractTypeEnum[] lstEnum = ContractTypeEnum.values();
			for(ContractTypeEnum ct : lstEnum){
				if(ct.code == code){
					return ct;
				}
			}

			return null;
		}

		public static ContractTypeEnum fromType(String display){
			ContractTypeEnum[] lstEnum = ContractTypeEnum.values();
			for(ContractTypeEnum ct : lstEnum){
				if(StringUtils.equals(ct.type, display)){
					return ct;
				}
			}

			return null;
		}

		public static String fromDisplay(String display){
			ContractTypeEnum ct = fromType(display);
			if(ct != null){
				return ct.toString();
			}

			return StringUtils.EMPTY;
		}
	}

}
